<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  
  <title>OmegaT, the free translation memory tool</title>
  <meta name="generator" content="screem 0.10.2" />
  
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  
  <meta name="keywords" content="translation memory, TM, computer-aided translation, computer-assisted translation, CAT, GPL, open source" />

  
<link rel="stylesheet" type="text/css" href="../../config/howto.css" />
</head>

<body>

<div id="container">
			
<div id="banner">

<h1>OmegaT</h1>

<p>The free (GPL) translation memory tool</p>

</div>

<div id="content">

<h2>OmegaT HowTo: <br/>Translating Word 2007 (Office Open XML, .docx) files in OmegaT</h2>

<p>This HowTo provides tips on translating MS Office 2007 (and later) files in OmegaT.</p>

<h3>Background</h3>

<p>With the advent of Microsoft Office 2007, Microsoft Word, Excel and Powerpoint have new default file formats. These formats are formally known as &quot;Office Open XML&quot;, and have the extensions .docx, .xlsx and .pptx respectively. The formats are also used in MS Office 2010. For the sake of convenience, they will be referred to below as &quot;MS Office 2007 file formats&quot;.</p>

<p>From Version 1.7.1 onwards, OmegaT has been able to handle Microsoft Office 2007 files directly, without conversion. With the appearance of OmegaT Version 2.1.8, the handling of this file format in OmegaT also became much more user-friendly.</p>

<h3>The advantages of using the .docx format in conjunction with OmegaT</h3>

<p>As customers/authors upgrade Microsoft Office/Word to more recent versions, translators can expect to receive files increasingly in the new format. Unlike the legacy .doc, .xls and .ppt formats, these files can be handled directly in OmegaT, with no loss of formatting as a result of conversion to and from other formats.</p>

<p>The new format can also serve as a useful way of handling the legacy .doc, .xls and .ppt formats, since they can be converted to their MS Office 2007 counterparts, translated in OmegaT, and converted back again. This procedure is therefore an alternative for translators who would prefer not to use OpenOffice.org for this purpose.</p>

<h3>Converting to MS Office 2007 format</h3>

<p>You can convert MS Office 1997/2000/2003/XP files to MS Office 2007 format by opening them in MS Office 2007 and saving them with &quot;Save As&quot; in the new format. (Since this is now the standard format, it is simply described as Word, Excel or Powerpoint in MS Office 2007).</p>

<p>For users who do not have MS Office 2007 or 2010 and do not wish to buy it, Microsoft provides a <a href="http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&amp;display">compatibility plug-in</a> for earlier versions.</p>

<p>Linux users: both MS Office 2007 and the Microsoft compatibility plug-in run on <a href="http://www.codeweavers.com">Crossover Linux.</a></p>

<h3>Points to note when using the .docx, .xlsx and .pptx formats in OmegaT</h3>

<p>In OmegaT versions prior to 2.1.8, each formatting change in an MS Office 2007 file resulted in a long series of multiple tags, which often made handling this file format impractical. As of version 2.1.8, by default, these multiple tags are now aggregated (condensed) into a single tag. Users wishing to translate MS Office 2007 files should therefore upgrade to OmegaT version 2.1.8 or later.</p>

<p>(The greater ease of tag handling with .docx files comes at the cost of a slight loss in control over formatting. For example, without the &quot;aggregate tags&quot; function, where a word in the source text is in bold or italics, the translator could choose to render it in bold only, or in italics only. With the &quot;aggregate tags&quot; function enabled, this is not possible. Most users will probably find that the greater ease of use outweighs this drawback.)</p>

<p>The .docx format is also prone to the introduction of &quot;nuisance&quot; formatting code which results in unwanted and unnecessary tags appearing in OmegaT&apos;s editor pane. Since these are inconvenient during translation, it is worthwhile trying to remove these nuisance tags before beginning translation in OmegaT. OmegaT shares this problem with other CAT tools that handle the .docx format, and the solutions are similar or the same.</p>

<h3>How to remove unwanted formatting code from .docx files</h3>

<ul>


<li><p>Word 2007 marks any words not in its spelling dictionary with tags, so even a couple of words which it considers to be mis-spelt will result in a plethora of tags. If every single word in OmegaT is enclosed within tags, it is possible that Word has attempted to spell-check the text without access to a suitable spelling dictionary, and has therefore marked each word as mis-spelt. One solution is to switch off automatic spelling checking in Word.</p></li>
<li><p>Automatic hyphenation also adds unnecessary tags, so disable it. It may be necessary to do this for each document, in which case the procedure in Word 2007 is: Click the Page Layout tab; in the Page Setup group, click Hyphenation; then click None.</p></li>

<li><p>Use Search and Replace to remove double spaces (replacing them with a single space).</p></li>

<li>If your text contains both Asian and &quot;normal&quot; (e.g. Latin) characters, use Ctrl+A to select the entire text, then select a single font for it. Be careful to choose a font that contains both the necessary Asian and &quot;normal&quot; characters, such as MS Mincho, but without the &quot;[text body]&quot; style suffix.</li>

<li><p>Word 2007 inserts a tag at page breaks, even automatic page breaks. This tag apparently cannot be removed.</p></li>

</ul>

<p>Note that even after Word&apos;s settings have been changed so that it does not insert &quot;nuisance&quot; codes, for example for auto-hyphenation, such codes may still be present in the file and not removed by the change in configuration. Removal of these codes is described below. Before following the instructions below for removal of the nuisance codes, however, remember to make the configuration changes in Word first, or Word may simply re-insert nuisance codes again when the file is next opened.</p>

<h3>CodeZapper macro</h3>

As already mentioned, this problem with MS Office 2007 is not unique to OmegaT. Translator <a href="http://asap-traduction.com/CodeZapper">David Turner</a> has written an MS Word macro (strongly recommended!) to deal with the problem.

<h3>Levelling character formatting</h3>

<p>An alternative to running the CodeZapper macro on your text is to &quot;level&quot; the formatting. &quot;Levelling&quot; the formatting means applying the format of the first character in a selection of text (such as a whole paragraph) to all subsequent characters. Note that this is not the same as &quot;deleting&quot; the formatting, which would cause the character formatting to revert to the document&apos;s default.</p>

<p>You can level the formatting of paragraphs essentially by copying whole paragraphs in MS Word and pasting them back over themselves such that the entire paragraph assumes the formatting of the first character.</p>

<h3>Levelling the character formatting of a paragraph manually</h3>

<p>Step 1: Unhide the paragraph mark. Mark each paragraph by clicking on it repeatedly until the entire paragraph is highlighted. Then move the end of the highlighting one character to the left so that it does not include the paragraph mark.</p>

<p>Step 2: Copy this highlighted text (Ctrl+C). Then select &quot;Paste Special&quot; (Word 2003) or click on the arrow at the bottom of the &quot;Insert&quot; button (Word 2007) to obtain the extended Paste options. Finally, insert the content using the &quot;Unformatted Unicode text&quot; option.</p>

<p>Where paragraphs do contain inline formatting (bold, italics, hyperlinks, etc.), you can either:</p>

<p>- level the formatting from these paragraphs using the macro as described above, then re-insert the formatting; or</p>

<p>- mark only the text up to the beginning of the formatted part, copy this text and paste it back over itself, then repeat the process on the text after the formatted part. </p>

<h3>Creating a macro to level the character formatting of a paragraph</h3>

<p>You can automate the above procedure somewhat by creating a macro. Brief instructions for creating the macro (in MS Office 2007) are provided below. (For more detailed instructions, refer to your instruction manual or click <a href="http://office.microsoft.com/en-us/word-help/record-or-run-a-macro-HA010099769.aspx">here</a>, <a href="http://www.dummies.com/how-to/content/how-to-create-a-word-2007-macro.html">here</a> or <a href="http://oit.nd.edu/training/documentation/documents/macro_qrg.pdf">here</a>.)</p>

<p>If you have not already done so, add the Developer tab to the ribbon as follows: click on the Office button. Select Word Options. Click Popular in the Word Options dialog box. On the ribbon, check Show Developer tab and confirm with OK. Close Word.</p>

<p>Launch Word again, create a new Word file and add a paragraph of sample text, at least three lines long, e.g.:</p>

<p>This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.</p>

<p>Click on the paragraph mark button to make paragraph marks visible.</p>

<p>Place the cursor in your paragraph of text (not in the first or last lines).</p>

<p>Create the macro:</p>

<p>On the Developer tab, click on Record Macro.</p>

<p>In the Macro name box, type a name for the macro, such as &quot;levelformat&quot;. To make the macro available in all documents, select Normal.dotm in the &quot;Store macro in&quot; box. If you have made changes to your Normal.dotm, you might want to back this up first. </p>

<p>Click on the Keyboard button. Click in the box for a new keyboard combination, then experiment with keyboard combinations to find one that is not assigned. If a combination you try is already assigned, a message to this effect is displayed in the dialogue, and you can delete the combination and try another. Ctrl+Shift+9 appears not to be assigned to any other function in the basic Word installation, but you can use any other combination that has not already been assigned.</p>

<p>Click on Assign to assign the shortcut to the macro that you are about to record. Anything you now do will be recorded in the macro, so follow this procedure carefully:</p>

<p>Ctrl+Cursor Up (this takes the cursor to the beginning of the paragraph)</p>
<p>Ctrl+Shift+Cursor Down (this selects the paragraph, including the paragraph mark)</p>
<p>Shift+Cursor Left (this moves the end of the selection one character to the 
left so that it no longer includes the paragraph mark)</p>
<p>Ctrl+C (this copies the paragraph)</p>
<p>Ctrl+V (this pastes the text of the paragraph back over the paragraph)</p>

<p>After entering these commands, click Stop Recording.</p>

<p>Click on Macros and select levelformat (or whatever name you gave to your macro), then Edit. The 
code of your macro(s) will be displayed. For levelformat, this should be:</p>

<p>___________________<br/>
Sub levelformat()<br/>
&apos;<br/>
&apos; levelformat macro<br/>
&apos;<br/>
&apos;<br/>
    Selection.MoveUp Unit:=wdParagraph, Count:=1<br/>
    Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend<br/>
    Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend<br/>
    Selection.Copy<br/>
    Selection.PasteAndFormat (wdPasteDefault)<br/>
End Sub<br/>
___________________</p>

<p>Change the line:</p>
<p>    Selection.PasteAndFormat (wdPasteDefault)</p>
<p>to:</p>
<p>    Selection.PasteSpecial DataType:=wdPasteText</p>

<p>Save with Ctrl+S, and close the macro editing window.</p>

<p>If all has gone according to plan, your macro should now work. To test it, add some formatting to your Word document, for example by making one word bold. Now simply place the cursor anywhere in the paragraph and press Ctrl+Shift+9 (or whatever other keyboard shortcut you selected), and you should see the formatting disappear.</p>

<p>You can change the keyboard shortcut at any time. To do this, click the main &quot;Office&quot; button, then Word options (bottom right of the dialog).</p>

<p>Click Customize &gt; Choose commands. Choose Macros from the drop-down list. Select &quot;levelformat&quot; (or whatever you called it).</p>

<p>At the bottom of the dialog next to Keyboard shortcuts, click on Customize.</p>

<p>In the Categories box, scroll down to Macros and select it. Then on the right, under Macros, select levelformat (or whatever you called your macro). The current shortcut will be displayed in the relevant box. You can clear it by selecting it and hitting Delete. You can then enter a new shortcut and assign it with Assign as you did before. Close/confirm the dialogs.</p>

<p>You can use a similar procedure to create a button for your macro:</p>

<p>Again, click the main &quot;Office&quot; button, then Word options.</p>

<p>Click Customize &gt; Choose commands. Choose Macros from the drop-down list. Select your macro.</p>

<p>Click on Add. You should see the macro command appear in the right-hand column. Click on Modify.</p>

<p>Pick a symbol, then OK &gt; OK. The symbol for your macro should appear in the toolbar.</p>

<p>This macro is useful for levelling the formatting of a whole paragraph that contains no visible formatting. Where a paragraph contains desired formatting, you must restore the deleted formatting after levelling the paragraph. In paragraphs containing lots of formatting, restoring the deleted formatting can be quite a lot of work. For such paragraphs, consider the following alternatives: </p>

<ul> 

<li><p>Use Dave Turner&apos;s CodeZapper macro. </p></li>

<li><p>Create a second macro (with its own button and/or keyboard shortcut) of your own that only levels highlighted text, rather than the entire paragraph. (Record as described above, but only recording the command Ctrl+C followed by Ctrl+V.) You can then highlight text between the points at which formatting changes. This will level the formatting over sections of text that have the same, desired formatting, and you will not then need to restore deleted formatting.</p></li>

<li><p>Use the level formatting macro only on paragraphs with little or no formatting. Paragraphs that you have not &quot;levelled&quot; will then contain nuisance tags, but at least the others will be much &quot;cleaner&quot;.</p></li>

<li><p>More advanced users may wish to try OmegaT&apos;s Text Export function. In conjunction with the te-st-notags script, this provides a separate window in which tags are not displayed. You must still handle tags properly when producing and editing your translation, but you can view it in a separate window without the clutter of tags ("tag soup").</p></li>

</ul>

<p>Copyright Marc Prior 2009-2011</p>

</div>

<div id="footer"><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=68187&amp;type=1" alt="SourceForge.net Logo" height="31" width="88" /></a><br />

<a href="http://validator.w3.org/check?uri=referer"><img src="../../images/xhtml.png" alt="Valid XHTML" /></a> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="../../images/css.png" alt="Valid XHTML" /></a>
	</div>

</div>

</body></html>

